﻿using KayakMes.Check.Application.Input;
using KayakMes.Check.Application.OUT;
using KayakMes.Check.Application.Version;
using KayakMes.Check.Domain;
using KayakMes.Common.Result;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Yitter.IdGenerator;

namespace KayakMes.Check.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class VersionController : ControllerBase
    {
        private readonly IVersionService _versionService;
        public VersionController(IVersionService versionService)
        {
            _versionService = versionService;
        }

        /// <summary>
        /// 添加版本
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPost]
        public ApiResult<int> AddVersion(AddVersioninput input)
        {
            return _versionService.AddVersion(input);
        }

        /// <summary>
        /// 获取所有版本分页
        /// </summary>
        /// <param name="input">分页查询参数</param>
        /// <returns>分页结果</returns>
        /// 
        [HttpGet]
        public ApiPaging<VersionOut> GetAllVersion([FromQuery]GetVersionInput input)
        {
            return _versionService.GetAllVersion(input);

        }

        /// <summary>
        /// 删除版本
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public ApiResult<int> DeleteVersion([FromQuery]long Id)
        {
           return _versionService.DeleteVersion(Id);
        }
    }
}
